{include file="Public:header2"/}
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <xblock>
                <div style="padding-bottom: 10px;">
                    <a class="layui-btn" onclick="card_shang_add({$goods_id})">添加等级</a>
                    <span style="line-height:40px;float:right;">共有数据： {$count}条</span>
                </div>
            </xblock>  
            <table class="layui-table" style="text-align:center">
                <thead>
                <tr>
                    <th>等级名称</th>
                    <th>等级图标</th>
                    <th>发光特效</th>
                    <th>等级概率({$pro}%)</th>
                    <th>排序</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="vo"}
                <tr>
                    <td>{$vo['title']}</td>
                    <td>{if $vo['imgurl']}<img src="{:imageUrl($vo['imgurl'])}" style="width:50px;height:30px;">{/if}</td>
                    <td>{if $vo['special_imgurl']}<img src="{PHP} echo imageUrl($vo['special_imgurl']){/php}" style="width:60px;height:60px;">{/if}</td>
                    <td>{$vo['pro']*1}%</td>
                    <td>{$vo['sort']}</td>
                    <td>
                        <a style="text-decoration:none" onclick="card_shang_edit({$vo.id})" class="layui-btn layui-btn-radius layui-btn-normal layui-btn-xs">
                            <i class="layui-icon layui-icon-edit"></i>编辑
                        </a>
                        <a style="text-decoration:none" onclick="card_goodslist({$vo['id']},'{$vo.title}')"  class="layui-btn layui-btn-warm layui-btn-xs">等级奖品</a>
                        <a style="text-decoration:none" onClick="card_shang_del({$vo.id},'删除')" class="layui-btn layui-btn-danger layui-btn-xs">
                            <i class="layui-icon layui-icon-delete"></i>删除
                        </a>
                    </td>
                </tr>
                {/volist}
                {if condition="empty($list)"}
                <tr><td colspan='10' style="text-align:center;">暂时没有数据！</td></tr>
                {/if}
                </tbody>
            </table>
        </div>
    </div>
</div>
{include file="Public:footer"/}
<script type="text/javascript">
    layui.use(['layer','laydate'], function(){
        var $ = layui.$;

    })

    //添加卡等级
    function card_shang_add(goods_id) {
        var url  = "{:url('/admin/card_shang_add?goods_id="+goods_id+"')}";
        layer.open({
            type: 2,
            title: '添加卡等级',
            shadeClose: false,
            shade: 0.3,
            area: ['90%', '90%'],
            content: url,
        });
    }

    //编辑卡等级
    function card_shang_edit(id) {
        var url  = "{:url('/admin/card_shang_edit?id="+id+"')}";
        layer.open({
            type: 2,
            title: '编辑卡等级',
            shadeClose: false,
            shade: 0.3,
            area: ['90%', '90%'],
            content: url,
        });
    }

    //删除
    function card_shang_del(id,type_name){
        layer.confirm('确认要执行'+type_name+'操作吗？',function(){
            var url = "{:url('/admin/card_shang_del')}";
            var load=layer.load(2);
            var $ = layui.$;
            $.post(url,{"id":id},function(data){
                if(data.status == 1){
                    layer.msg('操作成功',{icon:1,time:1000},function(){
                        location.reload();
                    });
                }else{
                    layer.msg(data.msg,{icon:2,anim:6,time:1000},function(){
                        layer.close(load);
                    });
                }
            })
        });
    }

    //盒子奖品
    function card_goodslist(shang_id,title) {
        var url  = "{:url('/admin/card_goodslist?shang_id="+shang_id+"')}";
        layer.open({
            type: 2,
            title: title+'  等级奖品',
            shadeClose: false,
            shade: 0.3,
            area: ['95%', '95%'],
            content: url,
        });
    }

</script>
</body>
</html>


